Release 10.1A: OpenEdge Development:
Progress Dynamics Advanced Development
Accessing the manager from SDOs
When an SDO is initialized, it requests the field edit data for its enabled tables. To define the code to support this, you can create a custom override procedure for the data class. As with other custom super procedures used to subclass an object, edit the
src/adm2/custom/datacustom.iprocedure to uncomment the line that starts the super procedureadm2/custom/datacustom.p.Then create a localsrc/adm2/custom/datacustom.pprocedure and edit it to add a local version ofinitializeObject. For example:
The procedure first gets the handle of the new manager from the Session Manager, using the Session Manager’s global handle,
gshSessionManager, and the logical nameFieldEditManager. Then it gets the list of enabled tables from the SDO itself and runs thecacheFieldEditsprocedure in the manager.Next, the SDO needs a procedure to do validations against the rules defined in the field edits. If any errors in the detail are detected, this
fieldEditValidateprocedure creates a message string in the format expected by the standard validation support, as shown:
After retrieving the manager handle, the procedure retrieves the
LogicBufferhandle from the SDO. TheLogicBufferis in fact defined in the logic procedure of the SDO, and is the buffer for the record as it is accessed by the validation entry points in the logic procedure, such asrowObjectValidate, as shown:
For each column in the buffer, the code asks the Field Edit Manager whether there is a
Requirededit type or aCaseedit type defined for that field, by runninggetFieldEditData, as shown:
Note: This is not a particularly efficient way to determine which fields are required, since it involves making a separate call to the manager for every field in the SDO’s buffer, even though most of these probably do not have a record in the temp-table cache. If you are designing a new manager, you should consider the most efficient way to get the information you need and structure the data and the calls accordingly.
If there is a
Requiredtype, and its value isYes(which is normally the case if it is defined at all), and theSTRING-VALUEof the field is blank, then the code uses the framework’saferrortxt.iinclude file to format a message using the built-in message with the keyAF1, as shown:
If you look up this message in the Administration System menu, under Message Control, you see the display shown in Figure 7–6.
Figure 7–6: Message Control window
![]()
The
hColumn:LABELargument toaferrortxt.iis the value used for the substitution argument&1in the Error Summary Description.Next, the code checks the other type of edit, which specifies that a character field should be uppercase or lowercase, and makes the appropriate change, as shown:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |